<!-- 左边题型列表 -->
<template>
  <div class="reqTypeSection">
    <div class="req_content">
      <div class="req_tab_row">
        <ul>
          <li v-for="(item , index) in tabList" :key="index" :class="item.value == activeValue ? 'activeTab' : ''" @click="activeValue = item.value">{{item.name}}</li>
        </ul>
      </div>
      <div class="req_tab_content" v-if="activeValue == 1">
        <el-collapse v-model="activeNames">
          <el-collapse-item :title="item.topic" :name="i + 1" v-for="(item , i) in templateList" :key="i">
            <ul>
              <li class="req_icon" v-for="(icon , k) in item.cates" :key="k" @click="choose(icon)"><i :class="icon.icon"></i><span>{{icon.topic}}</span></li>
            </ul>
          </el-collapse-item>
        </el-collapse>
      </div>
      <div class="req_tab_content" v-if="activeValue == 2">
        <div class="topLine_item" v-for="(topic , picIndex) in changeItemData.questions" :key="picIndex">
          {{picIndex + 1}}. {{topic.topic}}
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { templateList , list } from '../data.js'
export default {
  props: {
    topicLine:{
      type: Array,
      default() {
        return []
      }
    },
    changeItemData:{
      type:Object,
      default(){
        return {
          questions:[]
        }
      }
    }
  },
  computed: {
    templateList() {
      return templateList
    },
    list(){
      return list
    }
  },
  data() {
    return {
      activeValue:1,
      activeNames: [],
      tabList:[
        {
          name:'题型选择',
          value:1
        },
        {
          name:'问卷大纲',
          value:2
        }
      ]
    }
  },
  created() {},
  mounted() {},
  methods: {
    choose(item){
      this.$emit('chooseItem', item)
    }
  }
}
</script>
<style lang="scss" scoped>
::v-deep{
  .el-collapse-item__content{
    padding-bottom: 0;
  }
  .el-collapse-item__header{
    height: 40px;
    line-height: 40px;
    font-weight: bold;
    font-size: 14px;
  }
}
.reqTypeSection{
  height: 100%;
  box-shadow: 0px 0px 4px 0px #dfdfdf;
  background-color: #fff;
  .req_content{
    height: 100%;
    padding: 10px 0 40px;
    position: relative;
    overflow: auto;
    .req_tab_row{
      padding: 0 10px;
      color: #808080;
      font-size: 13px;
      position: absolute;
      top: 10px;
      width: 100%;
      left: 0;
      ul{
        background: #e8e8e8;
        margin: 0 auto 6px;
        padding: 3px;
        border-radius: 4px;
        list-style-type: none;
        display: flex;
        flex-direction: row;
        justify-content: center;
        width: 100%;
        li{
          width: 50%;
          text-align: center;
          line-height: 25px;
          cursor: pointer;
          &.activeTab{
            background: #FFF;
            box-shadow: 0px 0px 4px 0px rgb(0 0 0 / 20%);
            border-radius: 2px;
            color: #262626;
            font-weight: bold;
          }
        }
      }

    }
    .req_tab_content{
      width: 100%;
      padding-top: 37px;
      padding: 37px 10px 0;
      ul{
        list-style-type: none;
        padding: 0;
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        li{
          width: 50%;
          display: flex;
          flex-direction: row;
          align-items: center;
          cursor: pointer;
          border-radius: 15px;
          padding: 3px 10px;
          &:hover{
            background-color: #0095FF;
            color: #fff;
            i{
              color: #fff;
            }
          }
          i{
            font-size: 18px;
            color: #0095FF;
            margin-right: 5px;
          }
        }
      }
      .topLine_item{
        font-size: 14px;
        font-weight: 300;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        color: #646566;
        line-height: 37px;
        border-bottom: 1px solid #eee;
      }
    }
  }
}
</style>